<template>
    <div id="my">
        <header class="my-header">
            <div>
                <div style="width: .96rem;height: .96rem;border-radius: 50%;background: rgba(255,255,255,.6);margin-top: .6rem;margin-bottom: .34rem;margin-left: .48rem;">
                    <img @click="goeditmy()" :src="userInfo.headImg" style="border-radius: 50%;width:.88rem;height:.88rem;margin: auto auto;display: block;"/>
                </div>
				<span @click="goeditmy()">{{userInfo.nickname}}</span>
				<img @click="goeditmy()" src="https://khh-server.oss-cn-beijing.aliyuncs.com/resourse/IMG/static/my_edit@2x.png" style="margin-top: .98rem;margin-left: 0.14rem;height: 0.28rem;width: 0.28rem;">
            </div>
        </header>
        <div class="coupon">
            <div @click="goCoupon()" style="border-right: .04rem solid rgba(255,255,255,.26)">
                <dl>
                    <dd>{{userInfo.couponNum}}</dd>
                    <dt>优惠券</dt>
                </dl>
            </div>
            <div @click="goCutCoin()" style="border-right: .04rem solid rgba(255,255,255,.26)">
                <dl>
                    <dd>{{userInfo.integral}}</dd>
                    <dt>砍币</dt>
                </dl>
            </div>
            <div @click="goBalance()">
                <dl>
                    <dd>{{userInfo.money}}</dd>
                    <dt>余额</dt>
                </dl>
            </div>
        </div>
        <div class="order-detail">
            <div class="allOrder" @click="goAllOrder(0)">
                <span>我的订单</span>
                <span>查看全部订单<img src="https://khh-server.oss-cn-beijing.aliyuncs.com/resourse/IMG/static/more@2x.png"/></span>
            </div>
            <div class="orderStateList">
                <div>
                    <dl @click="goCutting">
                        <dd><span v-if="userInfo.kaningNum">{{userInfo.kaningNum<9?userInfo.kaningNum:"9+"}}</span><img src="https://khh-server.oss-cn-beijing.aliyuncs.com/resourse/IMG/static/bargaining@2x.png" ></dd>
                        <dt>砍价中</dt>
                    </dl>
                    <dl @click="goAllOrder(1)">
                        <dd><span v-if="userInfo.waitPay">{{userInfo.waitPay<9?userInfo.waitPay:"9+"}}</span><img src="https://khh-server.oss-cn-beijing.aliyuncs.com/resourse/IMG/static/no_paying@2x.png" ></dd>
                        <dt>待付款</dt>
                    </dl>
                    <dl @click="goAllOrder(2)">
                        <dd><span v-if="userInfo.waitPush">{{userInfo.waitPush<9?userInfo.waitPush:"9+"}}</span><img src="https://khh-server.oss-cn-beijing.aliyuncs.com/resourse/IMG/static/no_ship@2x.png" ></dd>
                        <dt>待发货</dt>
                    </dl>
                    <dl @click="goAllOrder(3)">
                        <dd><span v-if="userInfo.waitReceive">{{userInfo.waitReceive<9?userInfo.waitReceive:"9+"}}</span><img src="https://khh-server.oss-cn-beijing.aliyuncs.com/resourse/IMG/static/no_receiving@2x.png" ></dd>
                        <dt>待收货</dt>
                    </dl>
                    <dl @click="goAllOrder(4)">
                        <dd><span v-if="userInfo.waitRemark">{{userInfo.waitRemark<9?userInfo.waitRemark:"9+"}}</span><img src="https://khh-server.oss-cn-beijing.aliyuncs.com/resourse/IMG/static/no_assess@2x.png" ></dd>
                        <dt>待评价</dt>
                    </dl>
                    <dl @click="goRefund">
                        <dd><span v-if="userInfo.afterSale" style="right:.15rem;">{{userInfo.afterSale<9?userInfo.afterSale:"9+"}}</span><img src="https://khh-server.oss-cn-beijing.aliyuncs.com/resourse/IMG/static/683062537653749728.png" ></dd>
                        <dt>退款/售后</dt>
                    </dl>
                </div>

            </div>
            <div style="width: 100%;padding: .1rem 0;background: #f6f6f6"></div>
            <div class="myInfo">
                <div class="myinfoList">
                    <div @click="goHelpCut()"> 
                        <img src="https://khh-server.oss-cn-beijing.aliyuncs.com/resourse/IMG/static/bargain_record@2x.png">
                        <span>砍价记录</span>
                        <img src="https://khh-server.oss-cn-beijing.aliyuncs.com/resourse/IMG/static/more@2x.png"/>
                    </div>
                </div>
                <div class="myinfoList">
                    <div @click="goCollect">
                        <img src="https://khh-server.oss-cn-beijing.aliyuncs.com/resourse/IMG/static/collection@2x.png">
                        <span>我的收藏</span>
                        <img src="https://khh-server.oss-cn-beijing.aliyuncs.com/resourse/IMG/static/more@2x.png"/>
                    </div>
                </div>
               <!-- <div class="myinfoList">
                    <div @click="goFootePrict">
                        <img src="https://khh-server.oss-cn-beijing.aliyuncs.com/resourse/IMG/static/footprint@2x.png">
                        <span>我的足迹</span>
                        <img src="https://khh-server.oss-cn-beijing.aliyuncs.com/resourse/IMG/static/quanbu.png"/>
                    </div>
                </div>-->
                <div class="myinfoList">
                    <div @click="goOpenshop">
                        <img src="https://khh-server.oss-cn-beijing.aliyuncs.com/resourse/IMG/static/shop@2x.png">
                        <span>我要开店</span>
                        <img src="https://khh-server.oss-cn-beijing.aliyuncs.com/resourse/IMG/static/more@2x.png"/>
                    </div>
                </div>
                <div class="myinfoList">
                    <div @click="goAddress()" style="border:none;">
                        <img src="https://khh-server.oss-cn-beijing.aliyuncs.com/resourse/IMG/static/shipping_address@2x.png">
                        <span>收货地址</span>
                        <span class="addMy" v-if="isAddress==2">完善我的地址</span>
                        <span style="width:.12rem;height:.12rem;background: #9948c3;border-radius: 50%;margin-left: .14rem;margin-top: .18rem;"  v-if="isAddress==2"></span>
                        <img src="https://khh-server.oss-cn-beijing.aliyuncs.com/resourse/IMG/static/more@2x.png"/>
                    </div>
                </div>
            </div>
            <div style="width: 100%;padding: .1rem 0;background: #f6f6f6"></div>
            <div class="myInfo">
                <div class="myinfoList" style="border:none;">
                    <a href="https://www.sobot.com/chat/h5/index.html?sysNum=8aa3c6e204e843ce93d80c7b9208d4e6" class="zhiCustomBtn">
                        <div>
                            <img src="https://khh-server.oss-cn-beijing.aliyuncs.com/resourse/IMG/static/talking/customer_service@2x.png">
                            <span>官方客服</span>
                            <img src="https://khh-server.oss-cn-beijing.aliyuncs.com/resourse/IMG/static/more@2x.png"/>
                        </div>
                    </a>
                   <!--<script class="zhiCustomBtn" id="zhichiScript" src="https://www.sobot.com/chat/h5/index.html?sysNum=8aa3c6e204e843ce93d80c7b9208d4e6" data-args="manual=true" charset="utf-8"></script>-->
                </div>
            </div>
        </div>
    </div>
</template>

<script>


    // var zhiManager = (getzhiSDKInstance());
    // console.log(zhiManager);
    // debugger
    // //对接用户身份、预留字段、自定义字段（旧版，不推荐）
    // zhiManager.set('userinfo', { //设置用户信息
    //     tel: '',   //电话或手机
    //     email: '',   //邮箱
    //     uname: '',   //昵称
    //     visitTitle: '',   //对话页标题，若不传入系统将获取用户打开咨询组件时所在页面的标题
    //     visitUrl: '',   //对话页URL，若不传入系统将获取用户打开咨询组件时所在页面的URL
    //     face: '',   //头像URL
    //     realname: '',   //真实姓名
    //     weibo: '',   //微博账号
    //     weixin: '',   //微信账号
    //     qq: '',   //QQ号
    //     sex: '', //0 男 1 女
    //     birthday: '',   //生日，如“1990-01-01”
    //     remark: '',   //用户的备注信息
    //     params: '{"等级":"VIP用户","客户状态":"意向客户"}'   //自定义用户信息字段
    // });
    // //对接用户身份、预留字段、自定义字段（新版，推荐）
    // zhiManager.set("customerFields",{"weibo":"weicat","sex":"女","birthday":"2017-05-17","cardType":"身份证","cardNo":"13010319xxxx56xxxx","address":"北京","position":"tl","remark":"good","customField1":"12","customField2":"text"});
    // zhiManager.set('size', { //悬浮窗宽度与高度
    //     // 最小宽度360像素，最大宽度640像素，默认360像素
    //     'width': 460,
    //     // 最小高度430像素，最大高度720像素，默认540像素
    //     'height': 680
    // });
    // zhiManager.set('preVisitArgs',{
    //     'preAbstract':'来源页的摘要  可不传',
    //     'preVisitUrl':'来源页的url   可不传',
    //     'preVisitTitle':'来源页的标题    可不传',
    //     'preThumbnail':'来源页的缩略图  可不传',
    //     'preTags' :'来源页的标签    可不传'
    // });
    // zhiManager.set('curVisitArgs',{
    //     'curAbstract':'当前页的摘要  可不传',
    //     'curVisitUrl':'当前页的url   可不传',
    //     'curVisitTitle':'当前页的标题    可不传',
    //     'curThumbnail':'当前页的缩略图  可不传',
    //     'curTags' :'当前页的标签    可不传'
    // });
    // //通过参数设置H5聊天页面显示商品信息内容
    // zhiManager.set("title_info","智齿_商品详情页_小智智能");  //必传 需编码
    // zhiManager.set("url_info","http://www.sobot.com/order/zc.html"); //必传 需编码
    // zhiManager.set("abstract_info","更精确的理解，更精确地回答，在闲聊寒暄中，拉近与客户的距离，导入知识库，意想不到的方便快捷，最简单的知识添加，事半功倍。"); //需编码
    // zhiManager.set("label_info","2000"); //需编码
    // zhiManager.set("thumbnail_info","http://test.sobot.com/console/images/logo_new.png"); //需编码
    // //自定义按钮后可设置该值改变悬浮窗的水平位置
    // zhiManager.set("customMargin",200);
    // //手动初始化时 通过 load 方法调用 js 组件
    // zhiManager.on("load", function(ret) {
    //     zhiManager.initBtnDOM();
    // });
    // //自定义按钮时 通过该方法获取客服发送的未读内容 & 消息数
    // zhiManager.on("receivemessage", function(ret) {
    //     /**
    //      * 返回格式：[{content:'您好',msgId:'615b0a3801804f14be1d456e11b329af',customName:'智齿科技'}]
    //      */
    //     console.log(ret);
    // });
    // //自定义按钮时 通过该方法获取客服发送的离线消息数
    // zhiManager.on("unread.count",function(data){
    //     console.log(data);
    // });
    //


    import Store from "../../store/store.js";
    import config from "../../config/config.js";
    import share from "../../share/share.js";
    import MtaH5 from 'mta-h5-analysis';
    export default{
        data(){
            return {
                userInfo:{},
                isAddress:'',
                num:0
            }
        },
        methods:{
            goCutting(){
                this.$router.push("/cutting")
            },
            goeditmy(){
                this.$router.push('/editmy')
            },
            goBalance(){
                this.$router.push("/balance");
            },
            goCutCoin(){
                this.$router.push("/cutCoin");
            },
            goCollect(){
                this.$router.push("/collect");
            },
            goAllOrder(index){
                this.$router.push("/allorder");
                sessionStorage.setItem("index",index);
            },
            goRefund(){
                this.$router.push("/refund");
            },
            goAddress(){               
                this.$router.push("/address/"+this.isAddress);
                sessionStorage.setItem("isjump",0);
            },
            goFootePrict(){
                this.$router.push("/footPrint")
            },
            goCoupon(){
                this.$router.push("/coupon/"+this.userInfo.couponNum);
            },
            goEveryday(){
                this.$router.push("/everyday");
            },
            goHelpCut(){
                this.$router.push("/helpCut")
            },
            goOpenshop(){
                this.$router.push("/openshop");
            },
          // UpdateMemberInfo(){
          //   var _self=this;
          //   var value=JSON.stringify({"token":localStorage.getItem('token')}),
          //     key=demo(value);
          //   axios.post('/Home/member/UpdateMemberInfo',{
          //     value:value,
          //     key:key
          //   },config)
          //     .then(function(response) {
          //       if(response.data.code==200){
          //         this.userInfo=response.data.data;
          //         var zhiManager = (getzhiSDKInstance());
          //         zhiManager.set('userinfo', { //设置用户信息
          //           partnerId:'',   //用户对接ID，用户唯一标示，通常是企业自有用户系统中的userId
          //           tel: '',   //电话或手机
          //           email: '',   //邮箱
          //           uname: '123',   //昵称
          //           visitTitle: '',   //对话页标题，若不传入系统将获取用户打开咨询组件时所在页面的标题
          //           visitUrl: '',   //对话页URL，若不传入系统将获取用户打开咨询组件时所在页面的URL
          //           face: 'http://thirdwx.qlogo.cn/mmopen/PiajxSqBRaEJy7g0Tptry9PejXcJkNb233zdwLIUs4Gblr7RkIowBIKgcUg7EpWF46YW2XtgnauS5fdGmoq0GJA/132',   //头像URL
          //           realname: '',   //真实姓名
          //           weibo: '',   //微博账号
          //           weixin: '',   //微信账号
          //           qq: '',   //QQ号
          //           sex: '1', //0 女 1 男
          //           birthday: '',   //生日，如“1990-01-01”
          //           remark: '',   //用户的备注信
          //           params: '{"等级":"VIP用户","客户状态":"意向客户"}'   //自定义用户信息字段
          //         });
          //         window.location.href='https://www.sobot.com/chat/h5/index.html?sysNum=8aa3c6e204e843ce93d80c7b9208d4e6'
          //       }else{
          //
          //       }
          //     }.bind(this))
          //     .catch(function (error) {
          //       console.log(error);
          //     });
          // }
        },
        activated(){
            var value=JSON.stringify({"type":"1","token":localStorage.getItem('token')}),
                key=demo(value);
            axios.post('/Home/Login/MemberInfo',{
                    value:value,
                    key:key
            },config)
                .then(function(response) {
                    this.userInfo=response.data.data;
                    this.isAddress=response.data.data.isAddress;
                }.bind(this))
                .catch(function (error) {
                    console.log(error);
                });
            share({});
            MtaH5.init({
                "sid":'500594815',
                "cid":'500595819',
                "autoReport":0,
                "senseHash":0,
                "senseQuery":0,
                "performanceMonitor":0,
                "ignoreParams":[]
            });
            MtaH5.pgv();
        },
        mounted(){

        },
      created(){

      }
    }
</script>


<style>
</style>